Skip to content

[PFA 3/n] Support PFA in const exprs#22785

Open
arnaud-lb wants to merge 3 commits into
php:masterfrom
arnaud-lb:partials-const-expr-simple
Open

[PFA 3/n] Support PFA in const exprs#22785
arnaud-lb wants to merge 3 commits into
php:masterfrom
arnaud-lb:partials-const-expr-simple

Conversation

@arnaud-lb

@arnaud-lb arnaud-lb commented Jul 17, 2026

Copy link
Copy Markdown
Member

See individual commits. First two are GH-22783 and GH-22784, which will be merged separately. (Edit: these were merged, and the branch has been rebased.)

@arnaud-lb arnaud-lb changed the title [PFA 3/n] Support PFA in const exprs [wip][PFA 3/n] Support PFA in const exprs Jul 17, 2026
@arnaud-lb
arnaud-lb force-pushed the partials-const-expr-simple branch from 0ff8119 to f5a4f79 Compare July 17, 2026 15:22
@arnaud-lb arnaud-lb changed the title [wip][PFA 3/n] Support PFA in const exprs [PFA 3/n] Support PFA in const exprs Jul 17, 2026

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the PR excluding the first two commits. The tests LGTM. For the implementation, I didn't see obvious issues (except formatting nits), but I'm not fully comfortable approving the C changes.

Comment thread Zend/tests/partial_application/constexpr_009.phpt Outdated
Comment thread Zend/zend_compile.c Outdated
Comment thread Zend/zend_ast.c Outdated
@arnaud-lb
arnaud-lb force-pushed the partials-const-expr-simple branch from 0a6d9cd to f153d7a Compare July 20, 2026 10:08
@arnaud-lb
arnaud-lb marked this pull request as ready for review July 21, 2026 12:07
@arnaud-lb
arnaud-lb requested review from bukka and dstogov as code owners July 21, 2026 12:07
… of the declaring opline itself

This makes the API compatible with creating partials from AST:
We can pass &ast->lineno to zend_partial_create()
@TimWolla

Copy link
Copy Markdown
Member

This can / should be rebased now.

The declaring op_array is used for multiple purposes:
 * Generating a PFA name
 * Finding the filename
 * Finding whether op_array is cached, and therefore whether the PFA should be
   cached too

However it's not available when evaluating a PFA AST.

Remove the declaring_op_array argument, and pass the relevant information
directly:
 * Generate the PFA name at compile time, pass it as argument to zend_partial_create()
 * Pass the filename and a cacheable flag as argument to zend_partial_create()
@arnaud-lb
arnaud-lb force-pushed the partials-const-expr-simple branch from f153d7a to 9391556 Compare July 22, 2026 08:01
@arnaud-lb

Copy link
Copy Markdown
Member Author

I was doing it :)

@TimWolla TimWolla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests still LGTM. No longer seeing issues in the C implementation, but this is not my area of expertise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants